<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>管理员列表</title>
    <th:block th:include="statics/common/page/header"></th:block>
</head>
<body>
<div id="sysUser" v-cloak>
    <div v-show="showList">
        <Row class="search-panel-space">
            <div class="search-group">
                <i-col span="5">
                    <label class="search-label-20">用户名:</label>
                    <i-input class="search-item-width-75" v-model="q.userName" @on-enter="query" placeholder="用户名"/>
                </i-col>
                <i-button type="info" @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                <!-- <i-button type="info" @click="add" th:if="${@shiroAuthService.hasPermission('sys:user:save')}">
                    <i class="fa fa-plus"></i>&nbsp;新增
                </i-button> -->
                <i-button type="warning" @click="update" th:if="${@shiroAuthService.hasPermission('sys:user:update')}">
                    <i class="fa fa-pencil-square-o"></i>&nbsp;修改
                </i-button>
                <i-button type="warning" @click="changepassword" th:if="${@shiroAuthService.hasPermission('sys:user:initpassword')}">
                    <i class="fa fa-cog"></i>&nbsp;初始化密码
                </i-button>
                <i-button type="error" @click="del" th:if="${@shiroAuthService.hasPermission('sys:user:delete')}">
                    <i class="fa fa-trash-o"></i>&nbsp;删除
                </i-button>
                <!-- <i-button type="error" @click="delToken" th:if="${@shiroAuthService.hasPermission('sys:token:delete')}"> -->
                <i-button type="error" @click="delToken">
                    <i class="fa fa-trash-o"></i>&nbsp;清除APPToken
                </i-button>
            </div>
        </Row>
        <table id="sysUserGrid"></table>
    </div>

    <Card v-show="!showList">
        <p slot="title" style="height: 35px;">{{title}}
            <i-button type="warning" @click="reload" style="margin-right: 8px;float: right;"/>
            返回</i-button></p>
        <i-form ref="formValidate" :model="user" :rules="ruleValidate" :label-width="80">
            <Form-item label="人员" prop="personName" style="width: 450px;">
                <i-input type="text" v-model="user.personName" disable placeholder="人员"/>
            </Form-item>
            <Form-item label="用户名" prop="userName" style="width: 450px;">
                <i-input v-model="user.userName" placeholder="登录账号" />
            </Form-item>
            <!-- <Form-item label="员工" prop="deptName">
                <i-input type="text" v-model="user.deptName" icon="eye" readonly="readonly"
                         @on-click=employeeGrid placeholder="员工"/>
            </Form-item> -->
            <Form-item label="邮箱" prop="email" style="width: 450px;">
                <i-input v-model="user.email" placeholder="邮箱"/>
            </Form-item>
            <Form-item label="QQ" prop="qq" style="width: 450px;">
                <i-input v-model="user.qq" placeholder="QQ"/>
            </Form-item>
            <!-- <Form-item label="手机号" prop="mobile" style="width: 450px;">
                <i-input v-model="user.mobile" placeholder="手机号"/>
            </Form-item> -->
            <Form-item label="角色" prop="roleIdList" style="width: 450px;">
	            <Checkbox-group v-model="user.roleIdList">
	            	<i-divider orientation="left" v-for="employee in employeeList">
	                    <Checkbox :label="role.id" v-for="role in roleList" v-if="employee.companyId == role.companyId">{{employee.companyName}}~{{role.roleName}}</Checkbox>
	            	</i-divider>
	            </Checkbox-group>
            </Form-item>
            <Form-item label="状态" prop="status" style="width: 450px;">
                <Radio-group v-model="user.status">
                    <Radio label="0">
                        <span>禁用</span>
                    </Radio>
                    <Radio label="1">
                        <span>正常</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>
<!-- 选择部门 -->
<div id="deptLayer" style="display: none;padding:10px;">
    <!-- <ul id="deptTree" class="ztree"></ul> -->
    <Row class="search-panel-space">
        <div class="search-group">
            <i-col span="3">
                <label class="search-label-20">用户名:</label>
                <i-input class="search-item-width-75" v-model="qop.name" @on-enter="queryOrgPerson" placeholder="名称"/>
            </i-col>
            <i-button type="info" @click="queryOrgPerson">查询</i-button>
            <i-button @click="reloadSearch">重置</i-button>
        </div>
    </Row>
    <table id="orgPersonGrid"></table>
</div>
<script th:src="@{../statics/js/sys/user.js}"></script>
</body>
</html>